﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PcapDotNet.Core;
using PcapDotNet.Packets;

namespace WNistnet
{
    public class Router
    {
        //网卡列表
        public IList<LivePacketDevice> AllDevices { get; set; }
        //ARP表
        private IList<ArpItem> arpTable;
        //路由表
        private IList<RouteItem> routeTable;
        //收发包队列
        private Queue<Packet> pakcetQueue;
        private int maxLengthOfPacketQueue = WNN.MAX_PACKET_QUEUE_LENGTH;
        //路由器运行状态
        private WNN.ROUTER_STATUS status = WNN.ROUTER_STATUS.INIT;

        public Router(IList<ArpItem> arpTable, IList<RouteItem> routeTable)
        {
            this.arpTable = arpTable;
            this.routeTable = routeTable;
        }

        //获取下一跳IP的MAC地址
        public string GetMacAddrFromArpTable(string ipAddress)
        {
            GetNextHopIPAddress(ipAddress);
            return ipAddress;
        }

        //获取下一跳的IP地址
        private string GetNextHopIPAddress(string dstIpAddress)
        {
            return dstIpAddress;
        }

        //获取路由的出接口
        public string GetOutInterface(string dstIpAddress)
        {
            return null;
        }
    }
}
